import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from 'vue-router'
import StartView from '../views/StartView.vue'
import HomeView from '../views/HomeView.vue'
import HelpView from '../views/HelpView.vue'
import UserInfoView from '../views/UserInfoView.vue'


const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'start',
    component: StartView
  },
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/home',
        component: () => import('../components/HomeComponent.vue')
      },
      {
        path: '/login',
        component: () => import('../components/LoginComponent.vue')
      },
      {
        path: '/register',
        component: () => import('../components/RegisterComponent.vue')
      },
      {
        path: '/category/:categoryId',
        component: () => import('../components/CategoryDetailComponent.vue')
      }
      , {
        path: '/myrecord',
        component: () => import('../views/MyRecord.vue')
      },
      {
        path: '/search/:searchInput',
        component: () => import('../views/SearchView.vue')
      },
      {
        //path: '/detail/:name/:productId',
        path: '/detail/:productId',
        component: () => import('../views/DetailsView.vue')
      }
    ]
  },
  {
    path: '/help',
    name: 'help',
    component: HelpView
  },
  {
    path: '/oauth/callback/gitee',
    name: 'gitee',
    component: () => import('../components/GiteeCallbackComponent.vue')
  },
  {
    path: '/oauth/callback/github',
    name: 'github',
    component: () => import('../components/GithubCallbackComponent.vue')
  },
  {
    path: '/userinfo',
    name: 'userinfo',
    component: UserInfoView
  },
  {
    path: '/myorders',
    name: 'myorders',
    component: () => import('@/pages/page2/views/AllOrder.vue')
  }
]




const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
